#!/usr/local/bin/bash

if [[ "$CHLOG" == "" ]]; then
    echo
    echo "You need to source your environment file. If you don't have one,"
    echo "See sandboxen/oubiwann/set_env.rc as an example. If you do have"
    echo "an env rc file, then you just need to run admin/set_env.sh."
    echo
    exit 1
fi

# get the changes
svn diff $CHLOG | \
    egrep '^\+'| \
    sed -e 's/^\+//g'| \
    sed -e 's/^/   /g'| \
    sed -e 's/^   \*/ \*/g'| \
    egrep -v '^   \+\+.*ChangeLog' > /tmp/commit-msg

echo
echo "Committing with this message:"
cat /tmp/commit-msg
echo
echo "Changed files:"
stat.sh
echo
CWD=`pwd`
svn commit --file /tmp/commit-msg $CHLOG $TODO $CWD && \
    rm /tmp/commit-msg || \
    echo "There was an error committing; message preserved."

